package com.jtpay.textpay.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferenceUtil {
    private static int MODE = Context.MODE_PRIVATE;

    public String spRead(Context context, String key) {
        return context.getSharedPreferences("UserManager", MODE).getString(key, "");
    }

    public void spSave(Context context, String key, String value) {
        SharedPreferences.Editor localEditor = context.
                getSharedPreferences("UserManager", MODE).edit();
        localEditor.putString(key, value);
        localEditor.apply();
    }
    public void spRemove(Context context){
        @SuppressLint("CommitPrefEdits") SharedPreferences.Editor localEditor = context.
                getSharedPreferences("UserManager", MODE).edit();
        localEditor.remove("appid");
        localEditor.remove("appKey");
        localEditor.remove("aesKey");
        localEditor.remove("aesV");
        localEditor.apply();
    }
}
